#include "cgic.h"
#include "session.h"
int cgiMain() {
	unsigned char userbuf[100];
	unsigned char pwdbuf[100];
	int res;
	cgiFormString( "username", userbuf, 100) ;
	cgiFormString( "passwd", pwdbuf, 100) ;
	

	if(has_session()){
		cgiHeaderContentType("text/html");
		fprintf(cgiOut,"<br>");
		fprintf(cgiOut,"login success");
		return 0;
	}
	
	
	res = CGI_Logic_Judge(userbuf, pwdbuf);
	
	if(res==0){
		cgiHeaderContentType("text/html");
		fprintf(cgiOut,"<br>");
		fprintf(cgiOut,"login success");
	}else{
		cgiHeaderContentType("text/html");
		fprintf(cgiOut,"login error");
	} 
	
	return 0;
	
}
